package com.seleniti.enpareja.controller.common.domain;

import java.io.Serializable;

import com.seleniti.enpareja.controller.model.integration.database.domain.CoupleType;
import com.seleniti.enpareja.controller.model.integration.database.domain.Gender;

public class LoggedUserInfo implements Serializable {

	/**
	 * Serial number
	 */
	private static final long serialVersionUID = -9022962410409429547L;

	private String userId;
	private String userEmail;
	private String userName;
	private String coupleId;
	private String coupleName;
	private boolean requiredExternalLogoutUrl;
	private Gender gender;
	private boolean somePendingRequestsFromYou;
	private boolean someCoupleRequestsToYou;
	private boolean someRejectedRequestsFromYou;
	private boolean someNotifications;
	private boolean admin;
	private String sessionId;
	private boolean passwordSet;
	private CoupleType coupleType;
	private int coupleMemberNo;

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public boolean isLogged() {
		return getUserId() != null && getUserName() != null;
	}

	public boolean isRequiredExternalLogoutUrl() {
		return requiredExternalLogoutUrl;
	}

	public void setRequiredExternalLogoutUrl(boolean requiredExternalLogoutUrl) {
		this.requiredExternalLogoutUrl = requiredExternalLogoutUrl;
	}

	@Override
	public String toString() {
		return "LoggedUserInfo [userId=" + userId + ", userEmail=" + userEmail + ", userName=" + userName
				+ ", coupleId=" + coupleId + ", coupleName=" + coupleName + ", coupleType=" + coupleType
				+ ", requiredExternalLogoutUrl=" + requiredExternalLogoutUrl + ", gender=" + gender
				+ ", somePendingRequestsFromYou=" + somePendingRequestsFromYou + ", someCoupleRequestsToYou="
				+ someCoupleRequestsToYou + ", someRejectedRequestsFromYou=" + someRejectedRequestsFromYou
				+ ", someNotifications=" + someNotifications + ", admin=" + admin + ", sessionId=" + sessionId
				+ ", passwordSet=" + passwordSet + ", isLogged()=" + isLogged() + "]";
	}

	public Gender getGender() {
		return gender;
	}

	public void setGender(Gender gender) {
		this.gender = gender;
	}

	public String getCoupleName() {
		return coupleName;
	}

	public void setCoupleName(String coupleName) {
		this.coupleName = coupleName;
	}

	public String getCoupleId() {
		return coupleId;
	}

	public void setCoupleId(String coupleId) {
		this.coupleId = coupleId;
	}

	public String getUserEmail() {
		return userEmail;
	}

	public void setUserEmail(String userEmail) {
		this.userEmail = userEmail;
	}

	public boolean isSomePendingRequestsFromYou() {
		return somePendingRequestsFromYou;
	}

	public void setSomePendingRequestsFromYou(boolean somePendingRequestsFromYou) {
		this.somePendingRequestsFromYou = somePendingRequestsFromYou;
	}

	public boolean isSomeCoupleRequestsToYou() {
		return someCoupleRequestsToYou;
	}

	public void setSomeCoupleRequestsToYou(boolean someCoupleRequestsToYou) {
		this.someCoupleRequestsToYou = someCoupleRequestsToYou;
	}

	public boolean isSomeRejectedRequestsFromYou() {
		return someRejectedRequestsFromYou;
	}

	public void setSomeRejectedRequestsFromYou(boolean someRejectedRequestsFromYou) {
		this.someRejectedRequestsFromYou = someRejectedRequestsFromYou;
	}

	public boolean isAdmin() {
		return admin;
	}

	public void setAdmin(boolean admin) {
		this.admin = admin;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + (admin ? 1231 : 1237);
		result = prime * result + ((coupleId == null) ? 0 : coupleId.hashCode());
		result = prime * result + ((coupleName == null) ? 0 : coupleName.hashCode());
		result = prime * result + ((gender == null) ? 0 : gender.hashCode());
		result = prime * result + (requiredExternalLogoutUrl ? 1231 : 1237);
		result = prime * result + (someCoupleRequestsToYou ? 1231 : 1237);
		result = prime * result + (somePendingRequestsFromYou ? 1231 : 1237);
		result = prime * result + (someRejectedRequestsFromYou ? 1231 : 1237);
		result = prime * result + ((userEmail == null) ? 0 : userEmail.hashCode());
		result = prime * result + ((userId == null) ? 0 : userId.hashCode());
		result = prime * result + ((userName == null) ? 0 : userName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		LoggedUserInfo other = (LoggedUserInfo) obj;
		if (admin != other.admin)
			return false;
		if (coupleId == null) {
			if (other.coupleId != null)
				return false;
		} else if (!coupleId.equals(other.coupleId))
			return false;
		if (coupleName == null) {
			if (other.coupleName != null)
				return false;
		} else if (!coupleName.equals(other.coupleName))
			return false;
		if (gender != other.gender)
			return false;
		if (requiredExternalLogoutUrl != other.requiredExternalLogoutUrl)
			return false;
		if (someCoupleRequestsToYou != other.someCoupleRequestsToYou)
			return false;
		if (somePendingRequestsFromYou != other.somePendingRequestsFromYou)
			return false;
		if (someRejectedRequestsFromYou != other.someRejectedRequestsFromYou)
			return false;
		if (userEmail == null) {
			if (other.userEmail != null)
				return false;
		} else if (!userEmail.equals(other.userEmail))
			return false;
		if (userId == null) {
			if (other.userId != null)
				return false;
		} else if (!userId.equals(other.userId))
			return false;
		if (userName == null) {
			if (other.userName != null)
				return false;
		} else if (!userName.equals(other.userName))
			return false;
		return true;
	}

	public String getSessionId() {
		return sessionId;
	}

	public void setSessionId(String sessionId) {
		this.sessionId = sessionId;
	}

	public boolean isSomeNotifications() {
		return someNotifications;
	}

	public void setSomeNotifications(boolean someNotifications) {
		this.someNotifications = someNotifications;
	}

	public boolean isPasswordSet() {
		return passwordSet;
	}

	public void setPasswordSet(boolean passwordSet) {
		this.passwordSet = passwordSet;
	}

	public CoupleType getCoupleType() {
		return coupleType;
	}

	public void setCoupleType(CoupleType coupleType) {
		this.coupleType = coupleType;
	}

	public int getCoupleMemberNo() {
		return coupleMemberNo;
	}

	public void setCoupleMemberNo(int coupleMemberNo) {
		this.coupleMemberNo = coupleMemberNo;
	}

}
